package hn.sigit.logic.workflow.permits;

import hn.sigit.logic.viewer.InteractiveViewerHelper;
import hn.sigit.logic.viewer.InteractiveViewerHelper.BorderEditMode;
import hn.sigit.logic.viewer.InteractiveViewerHelper.CreateZoneMode;

import org.jboss.seam.Component;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;

@Scope(value=ScopeType.CONVERSATION)
@Name("digitizationHelper")
@AutoCreate
public class DigitizationHelper {
	@In
	private InteractiveViewerHelper interactiveViewerHelper;
	
	@In
	private BuildingPermitHelper buildingPermitHelper;

	@Create
	public void create() {
		InteractiveViewerHelper ivh = getInteractiveViewerHelper();
		
		ivh.setShowRightsToolbox(false);
		ivh.setShowRestrictionsToolbox(false);
		ivh.setShowResponsibilitiesToolbox(false);
		ivh.setShowDataToolbox(false);
		ivh.setShowSpatialAnalysisToolbox(false);
		ivh.setShowHelpToolbox(false);
		ivh.setShowTitle(false);
		ivh.setBorderEditMode(BorderEditMode.CREATE);
		ivh.setShowSaveModificationButtons(true);
		ivh.setAllowEditing(true);
		
		ivh.setBorderShapeExpr("buildingPermitHelper.permit.buildingUnit.shape");
		ivh.setCreateZoneMode(CreateZoneMode.SET_SHAPE_FIELD);

		ivh.setSelectedZone(getBuildingPermitHelper().getPermit().getSelectedZone());
	}
	
	public String getTitle() {
		return "Digitalizacion de la Nueva Edificacion";
	}
	
	public InteractiveViewerHelper getInteractiveViewerHelper() {
		if (interactiveViewerHelper == null)
			interactiveViewerHelper = (InteractiveViewerHelper) Component
			.getInstance("interactiveViewerHelper", ScopeType.CONVERSATION, true);
		return interactiveViewerHelper;
	}

	public BuildingPermitHelper getBuildingPermitHelper() {
		if (buildingPermitHelper == null)
			buildingPermitHelper = (BuildingPermitHelper) Component
			.getInstance("buildingPermitHelper", ScopeType.CONVERSATION, true);
		return buildingPermitHelper;
	}
	
	
}
